<html>
<head><meta charset="utf-8"><title>How do I pass rustdoc flags to x.py? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html">How do I pass rustdoc flags to x.py?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="206254217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254217">(Aug 07 2020 at 13:06)</a>:</h4>
<p>Specifically I want <code>-Z treat-err-as-bug</code>, I'm having trouble replicating  a bug with anything smaller than libproc_macro</p>



<a name="206254448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254448">(Aug 07 2020 at 13:09)</a>:</h4>
<p>ugh, looks like there's no equivalent of <code>RUSTFLAGS_NOT_BOOTSTRAP</code> in <code>bootstrap/builder.rs</code> <span aria-label="face palm" class="emoji emoji-1f926" role="img" title="face palm">:face_palm:</span> <span class="user-mention" data-user-id="116122">@simulacrum</span> do you mind if I add that?</p>



<a name="206254479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254479">(Aug 07 2020 at 13:09)</a>:</h4>
<p>I'm confused</p>



<a name="206254484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254484">(Aug 07 2020 at 13:09)</a>:</h4>
<p>RUSTFLAGS_NOT_BOOTSTRAP is a thing?</p>



<a name="206254497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254497">(Aug 07 2020 at 13:09)</a>:</h4>
<p><span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="206254561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254561">(Aug 07 2020 at 13:10)</a>:</h4>
<p>oh you want RUSTDOCFLAGS_NOT_BOOTSTRAP?</p>



<a name="206254566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254566">(Aug 07 2020 at 13:10)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">rustflags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Rustflags</span>::<span class="n">new</span><span class="p">(</span><span class="n">target</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="k">if</span><span class="w"> </span><span class="n">stage</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="mi">0</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="k">if</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="nb">Ok</span><span class="p">(</span><span class="n">s</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">env</span>::<span class="n">var</span><span class="p">(</span><span class="s">&quot;CARGOFLAGS_NOT_BOOTSTRAP&quot;</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="n">cargo</span><span class="p">.</span><span class="n">args</span><span class="p">(</span><span class="n">s</span><span class="p">.</span><span class="n">split_whitespace</span><span class="p">());</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
<span class="w">            </span><span class="n">rustflags</span><span class="p">.</span><span class="n">env</span><span class="p">(</span><span class="s">&quot;RUSTFLAGS_NOT_BOOTSTRAP&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="k">if</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="nb">Ok</span><span class="p">(</span><span class="n">s</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">env</span>::<span class="n">var</span><span class="p">(</span><span class="s">&quot;CARGOFLAGS_BOOTSTRAP&quot;</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="n">cargo</span><span class="p">.</span><span class="n">args</span><span class="p">(</span><span class="n">s</span><span class="p">.</span><span class="n">split_whitespace</span><span class="p">());</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
<span class="w">            </span><span class="n">rustflags</span><span class="p">.</span><span class="n">env</span><span class="p">(</span><span class="s">&quot;RUSTFLAGS_BOOTSTRAP&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">            </span><span class="n">rustflags</span><span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="s">&quot;--cfg=bootstrap&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="206254594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254594">(Aug 07 2020 at 13:10)</a>:</h4>
<p>yeah I want a way to pass custom arguments to rustdoc</p>



<a name="206254598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254598">(Aug 07 2020 at 13:10)</a>:</h4>
<p>you should be able to just use RUSTDOCFLAGS -- we'd never run rustdoc in more than one stage</p>



<a name="206254623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254623">(Aug 07 2020 at 13:11)</a>:</h4>
<p>(or at least not in local builds etc)</p>



<a name="206254663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254663">(Aug 07 2020 at 13:11)</a>:</h4>
<p>nope, it was ignored :(</p>



<a name="206254689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254689">(Aug 07 2020 at 13:11)</a>:</h4>
<p>what do you mean? <code>-vv</code> doesn't show it being passed?</p>



<a name="206254699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254699">(Aug 07 2020 at 13:11)</a>:</h4>
<p>we don't hide it from cargo...</p>



<a name="206254755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254755">(Aug 07 2020 at 13:12)</a>:</h4>
<p>correct</p>
<div class="codehilite"><pre><span></span><code>/home/joshua/rustc/build/bootstrap/debug/rustdoc --edition=2018 --crate-type lib --crate-name proc_macro library/proc_macro/src/lib.rs --target x86_64-unknown-linux-gnu -o /home/joshua/rustc/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/doc --error-format=json --json=diagnostic-rendered-ansi --markdown-css rust.css --markdown-no-toc -Z unstable-options --resource-suffix 1.47.0 --index-page /home/joshua/rustc/src/doc/index.md -L dependency=/home/joshua/rustc/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/joshua/rustc/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --extern std=/home/joshua/rustc/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libstd-425be41ab116c46d.rmeta -Dwarnings -Winvalid_codeblock_attributes
</code></pre></div>



<a name="206254771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254771">(Aug 07 2020 at 13:12)</a>:</h4>
<p>oh I see the problem</p>



<a name="206254776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254776">(Aug 07 2020 at 13:12)</a>:</h4>
<p>we <em>do</em> pass it</p>



<a name="206254825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254825">(Aug 07 2020 at 13:12)</a>:</h4>
<p>we just never read values into it from an env variable?</p>



<a name="206254873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254873">(Aug 07 2020 at 13:13)</a>:</h4>
<p>try using RUSTFLAGS_NOT_BOOTSTRAP -- if there's no errors in rustc that should still work</p>



<a name="206254924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254924">(Aug 07 2020 at 13:13)</a>:</h4>
<p>and i'd be happy to take a patch doing similar for rustdocflags</p>



<a name="206254941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254941">(Aug 07 2020 at 13:13)</a>:</h4>
<p>oof that's rebuilding libstd</p>



<a name="206254988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206254988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206254988">(Aug 07 2020 at 13:14)</a>:</h4>
<p>ok great, I'll work on that when I get a chance</p>



<a name="206255105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20pass%20rustdoc%20flags%20to%20x.py%3F/near/206255105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20pass.20rustdoc.20flags.20to.20x.2Epy.3F.html#206255105">(Aug 07 2020 at 13:15)</a>:</h4>
<p>opened <a href="https://github.com/rust-lang/rust/issues/75256">https://github.com/rust-lang/rust/issues/75256</a> so I don't forget</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>